/*
 * 作者:熊猫
 * 日期:2017 - 3 - 20 9 - 18 - 45
 *
 */

package net.lainiao.morethread.Chapter7.demo9;

/**
 * Created by Administrator on 2017/3/20.
 */
public class Consumer implements Runnable {
    private MyPriorityTransferQueue<Event> buffer;
    public Consumer(MyPriorityTransferQueue<Event> buffer){
        this.buffer=buffer;
    }
    @Override
    public void run() {
        for (int i = 0; i < 1002; i++) {
            try {
                Event value=buffer.take();
                System.out.println("Consumer:"+Thread.currentThread().getName()+" Value Priority = " +value.getPriority());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
